package vista;

import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaPosicion extends javax.swing.JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JPanel panContenedor;
	private JButton btnCerrar;
	private JTable tblListado;
	private JScrollPane scpListado;
	private JLabel lblTitulo;

	/**
	* Auto-generated main method to display this JFrame
	*/
		
	public VentanaPosicion() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panContenedor = new JPanel();
				getContentPane().add(panContenedor, BorderLayout.CENTER);
				panContenedor.setLayout(null);
				panContenedor.setBackground(new java.awt.Color(255,255,255));
				{
					lblTitulo = new JLabel();
					panContenedor.add(lblTitulo);
					lblTitulo.setText("Tabla de Posiciones");
					lblTitulo.setBounds(141, 18, 314, 18);
					lblTitulo.setFont(new java.awt.Font("Dialog",1,18));
					lblTitulo.setBackground(new java.awt.Color(30,144,255));
					lblTitulo.setForeground(new java.awt.Color(30,144,255));
				}
				{
					scpListado = new JScrollPane();
					panContenedor.add(scpListado);
					scpListado.setBounds(54, 42, 359, 188);
					scpListado.setBackground(new java.awt.Color(173,216,230));
					{
						tblListado = new JTable();
						scpListado.setViewportView(tblListado);
					}
				}
				{
					btnCerrar = new JButton();
					panContenedor.add(btnCerrar);
					btnCerrar.setText("Cerrar");
					btnCerrar.setBounds(174, 238, 119, 22);
					btnCerrar.setBackground(new java.awt.Color(173,216,230));
				}
			}
			pack();
			this.setSize(477, 299);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void setListado(AbstractTableModel abstractTableModel){
		tblListado.setModel(abstractTableModel);
	}
	
	public void mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}

	public void agregarListener(ActionListener accion){
		btnCerrar.addActionListener(accion);
	}
}
